home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Risc World 3
/
Risc World 3.iso
/
SOFTWARE
/
ISSUE3
/
PD
/
NEWALARM
/
!NewAlarm
/
Source
/
!RunImage
(
.txt
)
next >
Wrap
RISC OS BBC BASIC V Source
|
2001-10-05
|
46KB
|
1,839 lines
>!RunImage
"<NewAlarm$Dir>.Source.SHeap"
$+" at line "+
v$="1
33 (5 Oct 2001)"
Procedures start here
n%,m%,now
p$="NewAlarm"
(alarmpathT$="<"+p$+"$Dir>.Templates"
)param1$="":
for message substitution
param2$=""
block% 255
mainind% 1250,timeblock% 36
shutdown%=
:beep%=
count%=0
lib_lastopen%=-1
initbl% 12
initbl%!0=8
initbl%!4=&502
initbl%!8=&400C1
initbl%!12=0
"Wimp_Initialise",300,&4B534154,p$,initbl%
notfont%
notfont%=(notfont%<350)
initheaps(128,128)
report(
$+" at line "+
quit:
" temp%=
create_anchor("temp")
#Llast%=
create_anchor("last alarm"):
store data for last alarm triggered
$Fworkblock%=
create_anchor("workblock"):
for use of sort, later on
"Wimp_OpenTemplate",,alarmpathT$
extend_named_sliding_block(temp%,1600)
extend_named_sliding_block(workblock%,256)
edit%=
loadwindow("edit")
"Font_FindFont",,"Homerton.Bold",12*16,12*16,0,0
fonthandle%
*#am%=
fonticon("AM",fonthandle%)
+#pm%=
fonticon("PM",fonthandle%)
info%=
loadwindow("info")
main%=
loadwindow("main")
.!alarms%=
loadwindow("alarms")
/!repeat%=
loadwindow("repeat")
alert%=
loadwindow("alert")
1 warning%=
loadwindow("warn")
"Wimp_CloseTemplate"
extend_named_sliding_block(temp%,256)
scrap_sliding_block(workblock%)
"MessageTrans_FileInfo",,"<"+p$+"$Dir>.Messages"
,,n%
message% n%
mdata% 16
"MessageTrans_OpenFile",mdata%,"<"+p$+"$Dir>.Messages",message%
changetitle(edit%,
message_lookup("ws"))
date%=2
mth%=3
year%=4
day%=5
dayup%=6
daydn%=7
mthup%=8
mthdn%=9
yrup%=10
yrdown%=11
time%=12
m1%=15
hrup%=16
hrdown%=17
minup%=18
mindown%=19
m2%=20
m3%=21
reset%=22
edit_ok%=23
rept%=24
cancel%=25
repeat
numup%=1
numdn%=2
rept_num%=3
divup%=4
divdn%=5
div%=6
assembler(120)
seticontext(info%,0,p$)
seticontext(info%,1,"'Rough-time' Alarms")
seticontext(info%,2,"
Harriet Bazley 1999")
seticontext(info%,4,v$)
menus_init
b0anchor_block%=
create_anchor("anchor_block")
c)repeat_time%=
create_anchor("repeat")
create_named_sliding_block(repeat_time%,36)
hour%=timeblock%+&c
minute%=timeblock%+8
dayno%=timeblock%+&10
month%=timeblock%+&14
i=yr%=timeblock%+&18:
These are pointers into actual block
k4max%=0:
length of longest line in alarms window
lTwhichinmenu%=0:
transfers data on which alarm is being edited across Wimp_Polls
"XOS_ReadVarVal","Choices$Write",block%,256,0
,,n%:block%?n%=13
$block%=""
Choicespath$="<"+p$+"$Dir>."
Choicespath$=$block%+"."+p$+"."
loadalarms
getparameters(default_rep_type%,default_rep_interval%)
tCrep_type%=default_rep_type%:rep_interval%=default_rep_interval%
"XOS_File",16,Choicespath$+"Position",block%,0
(n%
w/ n%=
windowinfo(alarms%):
openwindow(main%)
no stored data
n%=block%+100
!n%=main%:n%!28=-1
"Wimp_OpenWindow",,n%
n%=block%
!n%=alarms%:n%!28=-1
"Wimp_OpenWindow",,n%
reopen windows at stored size & position
"OS_ReadMonotonicTime"
start
check_time(
make sure the window opens with up-to-date time in it
getparameters(
var1%,
var2%)
default values are 1 5 if invalid parameters passed to !RunImage
p$,param1$,o%,ptr%
var1%=1:var2%=5:
defaults
"OS_GetEnv"
p$,6):
remove "BASIC" from environment string
ptr%=!temp%
"OS_ReadArgs","quit/a,interval/e/k,value/e/k,autosave/s",p$,ptr%,256
ptr%!4>0
o%=ptr%!4:var1%=o%!1:
var1%<1
var1%>6
var1%=1
ptr%!8>0
o%=ptr%!8:var2%=o%!1
var1%=1
var2%=var2%-(var2%
var2%<1
var2%>255
var2%=5
autosave%=ptr%!12
menus_init
a$,b$,n%
param1$=p$
Dmainmenu%=
makemenu(
message_looksub("menu"),6):
make main menu
3recent%=
makemenu(
message_looksub("recent"),2)
param1$=
12," ")
message_looksub("del")+"|":a$=
4,a$)
%alarmmenu%=
makemenu(p$+"|"+a$,4)
submenuhandle(mainmenu%,1)+4)=info%
submenuhandle(mainmenu%,5)+4)=recent%
submenuhandle(mainmenu%,5))=2:
underline
grey(
submenuhandle(mainmenu%,5)+8,
n%=(FNsubmenuhandle(mainmenu%,5)+8)
!n%=!n% OR (1<<22):REM greyed out
makemenu(text$,num%)
n%,m%,menu%,a%,b$,max%,ptr%,x%
menu% 28+num%*24
text$,"|"):$menu%=
text$,n%-1)
menu%?12=7:menu%?13=2
menu%?14=7:menu%?15=0
menu%!20=44:menu%!24=0
ptr%=menu%+4
x%=1
num%
ptr%+=24:!ptr%=0:ptr%!4=-1
n%+=1
m%=
text$,"|",n%)
b$=
text$,n%,m%-n%)
(m%-n%)>max%
max%=m%-n%
m%-n%>11
a% (m%-n%)
$a%=b$
ptr%!8=&7000121
ptr%!12=a%
ptr%!16=0
ptr%!20=m%-n%
#
like indirected text icon
ptr%!8=&7000021
$(ptr%+12)=b$
n%=m%
/!ptr%=1<<7:
this should point to last item
menu%!16=(max%*16)+16
=menu%
submenuhandle(menu%,num%):
returns start of item in menu block
=menu%+28+(num%-1)*24
grey(ptr%,flag%)
flag%
!ptr%=!ptr%
(1<<22)
!ptr%=!ptr%
(1<<22)
"Wimp_PollIdle",&3CB0,block%,start
reason%,block%
reason(reason%)
"OS_ReadMonotonicTime"
(now-start)>0
start=start+600
reason(reason%)
reason%
0 :
beep%
start=start+120:
beep:
check_time(
1 :
redrawwindow
2 :
"Wimp_OpenWindow",,block%
3 :
closewindow(block%!0)
6 :
click(block%!12,block%!16,block%!8)
8 :
keypress(block%!24)
9 :
menuselect
17,18 :
message
report(
$+" at line "+
),1):
windowtitle(alarms%))<>"*"
"SlidingHeap_VerifyHeap",slidingheapbase%
"Font_LoseFont",fonthandle%
"Wimp_CloseDown"
centre(warning%)
freepointer
ptr%,x%,y%
screensize(x%,y%)
ptr%=!temp%
ptr%?0=1
ptr%?1=0:ptr%?2=0
ptr%?3=0:ptr%?4=0
#ptr%?5=x%
&FF:ptr%?6=x%
#ptr%?7=y%
&FF:ptr%?8=y%
"OS_Word",21,ptr%
dohelp
hlp$,keep%
keep%=block%!8
block%!32
2
-2:hlp$="Click MENU to test menu help.|M"
main%,edit%,alarms%,repeat%,info%,alert%,warning%: hlp$=
windowhelp(block%!32,block%!36)
hlp$=
menuhelp
block%!12=keep%
block%!16=&503
!block%=(25+
hlp$)
$(block%+20)=hlp$+
hlp$<>""
"Wimp_SendMessage",17,block%
menuhelp
a$,x$
"Wimp_GetMenuState",0,block%
submenuhandle(lib_lastopen%,1+block%!0)+8)
(1<<22)
x$="g"
x$="m":
check for greyed-out flag
#param1$=
message_lookup("this")
lib_lastopen%
mainmenu%:
block%!4>=0
x$="rp":block%!0=block%!4:
submenu
6 a$=
message_looksub("m"+x$+
(1+block%!0))
alarmmenu%:
6 a$=
message_looksub("a"+x$+
(1+block%!0))
=a$+"."
windowhelp(window%,icon%)
a$,d$,f$
window%
main%:param1$=p$:a$=
message_looksub("main")
alarms%:a$=
message_lookup("alrm")
info%:a$=
message_lookup("info")
warning%:
icon%=0
param1$=
message_lookup("mm3"):a$=
message_looksub("w0"):
message_lookup("w"+
(icon%))
edit%:a$=
message_lookup("edit")
a$+=".|M"
icon%
+-
0,1,14,13,26,27,-1:a$=
(a$)-3)
,D
5,2,3,4:f$=
message_lookup("sa"):d$=
message_lookup("dt")
-@
12:f$=
message_lookup("sa"):d$=
message_lookup("td")
.H
18,19,16,17:f$=
message_lookup("as"):d$=
message_lookup("td")
/J
6,7,8,9,10,11:f$=
message_lookup("as"):d$=
message_lookup("dt")
0-
:a$+=
message_lookup("e"+
(icon%))
1I
d$<>""
param1$=d$:param2$=f$:a$=a$+
message_looksub("when")
repeat%:a$=
message_lookup("rept")
icon%
45
1,2,4,5:d$=
message_lookup("as"):f$="int"
51
3,6:d$=
message_lookup("sa"):f$="int"
7,0,16,-1:
labels
73
geticontext(repeat%,icon%):f$="day"
8^
d$<>""
param1$=d$:param2$=
message_lookup("this"):a$+=".|M"+
message_looksub(f$)
=a$+"."
report(text$,flag%)
name$=p$
flag%
param1$=p$:name$=
message_looksub("warn")
flag%>255
name$=
message_lookup("esc"):flag%=19
!block%=255
$(block%+4)=text$+
"Wimp_ReportError",block%,flag%,name$
,errclick%
click(win%,icon%,button%)
worky%,n%,m%,txt$
button%=2
menuclick(win%,block%!0,block%!4):
worky%=block%!4
handles all non-MENU-clicks/drags
win%
warning%:
warningclick(icon%)
main%:
Double(*1)/click(*256)/drag(*16)
button%
P!
Select-double-click
Q]
geticontext(edit%,mth%)="Fish!"
settoday:
first time window opened today
clearalarm
S
openwindow(edit%)
T'
16,64:!block%=win%:block%!4=1
U9
"Wimp_DragBox",,block%:
drag whole window
V3
256:
SYS"Wimp_GetPointerInfo",,block%:
W'
openwindow(alarms%)
X0
Adjust-click opens as permanent
Y@
1024:
openwindow(main%):
Select-click brings to front
edit%:
icon%
].
rept%:n%=
iconselected(win%,rept%)
^k
openrepeatwindow
closewindow(repeat%):
open window next to edit% or close it
_V
reset%:
clearalarm:
settoday:
"Wimp_SetCaretPosition",edit%,m1%,0,0,-1,-1
`F
cancel%:
closewindow(edit%):
this will also close repeat%
a6
edit_ok%:
newalarm
closewindow(edit%)
bn
hrup%,hrdown%,minup%,mindown%,dayup%,daydn%,mthup%,mthdn%,yrup%,yrdown%:
changetime(icon%,button%)
c
repeat%:
repeat_or_delay(win%,icon%,button%,rep_interval%,rep_type%)
alarms%:
count%
f@ block%!0=win%:
"Wimp_GetWindowInfo",,block%
g5 worky%=worky%+block%!24-block%!16
i& n%=
line(worky%)
jU whichinmenu%=n%:
so we know which alarm to alter in FNnewalarm
kA
editalarm(n%):
only reports double-clicks
alert%:
freepointer:
alarm_gone_off
oA
clicks should only be detected over the OK icon
menuclick(window%,x%,y%)
handle%
window%=alert%
window%=alarms%
count%
putnameinmenu(block%!4):handle%=alarmmenu%
handle%=mainmenu%
"Wimp_CreateMenu",,handle%,x%-64,y%+20
lib_lastopen%=handle%
menuselect
d$,ptr%,n%
lib_lastopen%
mainmenu%:
1+block%!0
savealarms
openwindow(alarms%)
click(main%,0,4):
fake double-click on main window (set new alarm)
readlastalarm:
insert last alarm to go off back into list
1+block%!4
&
0,1:
check_time(1)
/
copy_alarm(
top_alarm,
alarmmenu%:
1+block%!0
editalarm(whichinmenu%)
(
deletealarm(whichinmenu%,
'
copy_alarm(whichinmenu%,
+
4:ptr%=
doublepling(whichinmenu%)
% n%=
decodedate(ptr%+4)
m%=0
&18
3 !(!repeat_time%+(m%))=block%!(m%)
F d$=
nextrepeat(ptr%,
message_lookup("format"),
now(d$))
E
throw away result - FNnextrepeat alters actual alarm
,
sort:
resizewindow(count%,
update window
"Wimp_GetPointerInfo",,block%
block%!8=1
"Wimp_CreateMenu",,lib_lastopen%
warningclick(icon%)
closewindow(warning%):
make sure we restore caret
freepointer:
icon%
savealarms
:
shutdown%
"Wimp_ProcessKey",508
restart shutdown if necessary
2:txt$=
windowtitle(alarms%)
$ txt$=
txt$,1,
(txt$)-2)
'
changetitle(alarms%,txt$)
:
discard - pretend data not unsaved after all
9
shutdown%
"Wimp_ProcessKey",508
shutdown%=
-----------Comparison routine for OS_HeapSort----------------------
assembler(length%)
pass%
ourcode% length%
L%=ourcode%+length%
first pass - enable range check,
i.e. OPT 8
second pass - enable error report
and range check, i.e. OPT 10
pass%=8
set P% to start of our code
on each pass
P% = ourcode%
now invoke the assembler
[OPT pass%
& ; set value of OPT as appropriate
D ; on entry R0 and R1 are pointers to words containing addresses
; of start of strings
LDR R0, [R0] ;R0=!R0
LDR R1, [R1] ;R1=!R1
LDR R0, [R0]
. LDR R1, [R1] ; 'double-pling' them
S R2, R0, R1 ;check if either R1 or R0 is zero
BEQ quickexit
ADD R0,R0,#4
> ADD R1,R1,#4 ;move pointers to start of timestring
J LDRB R2, [R0], #1 ;load R2 with contents of address contained in R0
J LDRB R3, [R1], #1 ;load R3 with contents of address contained in R1
CMP R2, R3
S LDREQB R2, [R0], #1 ;if they were the same, perform further check on next byte
LDREQB R3, [R1], #1
E CMPEQ R2, R3 ;only compare if necessary (saves branching)
LDREQB R2, [R0], #1
LDREQB R3, [R1], #1
CMPEQ R2, R3
LDREQB R2, [R0], #1
LDREQB R3, [R1], #1
CMPEQ R2, R3
LDREQB R2, [R0], #1
LDREQB R3, [R1], #1
J CMPEQ R2, R3 ;compare first five bytes (unroll loop for speed)
LDReqB R2, [R0,#-6]
LDReqB R3, [R1,#-6]
D CMPeq R2, R3 ;finally check repeat byte if times are same
MOV R15, R14
.quickexit
2 CMP R0, R1 ;do comparison right away
& MOV R15, R14 ;exit routine
we have now left the assembler
pass%
loadwindow(name$)
n%,ptr%
"Wimp_LoadTemplate",,!temp%,mainind%,timeblock%-36,-1,name$
,,mainind%
timeblock% immediately follows mainind% and is 36 bytes long
"Wimp_CreateWindow",,!temp%
changetitle(window%,name$)
n%,flag%
windowinfo(window%)
$(n%!76)=name$
flag%=n%!32
(flag%
1<<16)=0
window is not open - don't redraw area
"Wimp_ForceRedraw",-1,n%!4,n%!16,n%!12,(n%!16)+40
windowinfo(win%):
return info block
n%=!temp%
!n%=win%
"Wimp_GetWindowInfo",,n%
no room for icons in block!
seticontext(window%,icon%,text$)
"!block%=window%:block%!4=icon%
"Wimp_GetIconState",,block%
$(block%!28)=text$
block%!8=0:block%!12=0
"Wimp_SetIconState",,block%
geticontext(win%,icon%)
!block%=win%:block%!4=icon%
"Wimp_GetIconState",,block%
=$(block%!28)
message_lookup(token$)
text$,n%
"XMessageTrans_Lookup",mdata%,token$,0
,,text$;n%
%1 text$=""
=text$
message_looksub(token$)
set global variables param1/2$ before calling
n%,text$
"XMessageTrans_Lookup",mdata%,token$,!temp%,255,param1$,param2$,0,0
,,text$;n%
%1 text$=""
=text$
redrawwindow
n%,a$
"Wimp_RedrawWindow",,block%
block%!100=3
"OS_Word",14,block%+100
"Territory_ConvertTimeToOrdinals",-1,block%+100,block%+108
block%!120=4
!Bblock%!124=(block%!124)+1:
today includes tomorrow until 4 am
""a$=
timestring(block%+108),4)
year month day & hour (red alarms are today)
redraw(block%!0,block%!28,block%!32,block%!36,block%!40,a$)
"Wimp_GetRectangle",,block%
openwindow(whan%)
block%!0=whan%
"Wimp_GetWindowState",,block%
block%!28=-1
"Wimp_OpenWindow",,block%
whan%=edit%
"Wimp_SetCaretPosition",edit%,m1%,0,0,-1,-1
openrepeatwindow
width%,height%,x%,y%
block%!0=edit%
"Wimp_GetWindowState",,block%
x%=block%!12
y%=block%!16
block%!0=repeat%
"Wimp_GetWindowState",,block%
width%=block%!12-block%!4
height%=block%!16-block%!8
block%!4=x%
block%!8=y%-height%
block%!12=x%+width%
block%!16=y%
block%!28=-1
"Wimp_OpenWindow",,block%
seticontext(repeat%,rept_num%,
(rep_interval%)):
seticontext(repeat%,div%,
message_lookup("i"+
(rep_type%)))
user_modechange:
redraw font icons
"Font_LoseFont",fonthandle%
"Font_FindFont",,"Homerton.Bold",12*16,12*16,0,0
fonthandle%
!block%=edit%
block%!4=am%
"Wimp_GetIconState",,block%
M3block%!12=255<<24:
clear last eight bits of 32
N9block%!8=fonthandle%<<24:
insert new fonthandle here
"Wimp_SetIconState",,block%
block%!4=pm%
"Wimp_SetIconState",,block%
check_time(
beep%):
don't ask me why... but otherwise it doesn't
beep if an alarm goes off outside the desktop
icontext$)
h%,n%,m%,d$
!block%=3
"OS_Word",14,block%
"Territory_ConvertTimeToOrdinals",1,block%,block%+8
This is supposed to make the program international, but I'm not convinced.
block%!12=0
^0block%!8=0:
ignore seconds and centiseconds
h%=block%!20
`2n%=block%!16
n% gives the 'fudge factor'
m%=block%!16-n%
n%>2
m%+=5:
round to nearest five minutes
m%>30
loopzero(h%+1,23):
round up to next hour
d;d$=
timestring(block%+8):
before block% gets corrupted
((m%
60)=0
message_lookup("o")
'AND h%' means AND h% > 0 - can't have 'midnight o'clock'!
icontext$="It's "+
message_lookup("a"+
(n%))+
message_lookup("m"+
(m%))+
message_lookup("hr"+
(h%))+a$+".":
date in human format
h"=d$:
date in text code format
check_time(sound%):
should be called once every 6 seconds
h%,n%,m%,a$,d$
now(a$)
seticontext(main%,0,a$)
count%=0
otherwise check if alarm is due
top_alarm
a$=$(
doublepling(n%)+4)
d$>=a$
set_off_alarm(n%,d$,sound%)
timestring(ptr%)
We need to know minutes, hours, day, month and year
a$,n%
n%=8
&14
yI a$=
(65+ptr%!n%)+a$:
encode it backwards so that string comparison
z7
gives the right result
(65+ptr%!&18-1990)+a$:
year byte cannot exceed 256
and they complain when people use TWO characters to represent the year?!!
Why use two when one will do?
loadalarms
i%,n%,m%,ptr%,type%,dum%,a$,txt$
saveerror
(Choicespath$+"Alarms")
#i%,anchors%
anchors%=0
count%=anchors%
anchors%=0
resizewindow(anchors%,
extend_named_sliding_block(anchor_block%,anchors%*4)
9ptr%=!anchor_block%:
point to start of sliding block
n%=0
(anchors%-1)*4
C ptr%!n%=
create_anchor(
(65+n%)):
give them one-letter names
#i%,a$
#i%,txt$
m%=
(txt$)
notfont%
"Wimp_TextOp",1,
striptabs(txt$,
m%:m%=m%/16
measure string in desktop font
we are assuming a standard width of 16 pixels per char elsewhere
m%>max% max%=m%
create_named_sliding_block(ptr%!n%,4+
(txt$)+5+2)
enough space for the 5-byte date string, the message and 2 linefeeds
and repeat block at beginning
m%=ptr%!n%
$(!m%+4)=a$:$(!m%+10)=txt$
) type%=
#i%:?(!m%)=type%:
rep_type%
type%
type%=
#i%:?(!m%+1)=type%:type%=
#i%:?(!m%+2)=type%:
dum%=
#i%:dum%=
+ dum%=
get (unused) rest of word
Sliding block where each element is the address of a word of memory
holding the address of the start of a string. Confused? I am!
shouldn't be necessary - unless Generator was used to create alarms
resizewindow(anchors%,
savealarms
i%,txt$,n%,m%,p%
saveerror:
count%=0
"Remove "+Choicespath$+"Alarms"
*Remove doesn't give an error if file not found
"CDir "+
Choicespath$)
" i%=
(Choicespath$+"Alarms")
#i%,count%
n%=
top_alarm
p%=n%+count%
n%<p%
m%=
doublepling(n%)
#i%,$(m%+4)
#i%,$(m%+10)
#i%,?m%
#i%,m%?1
#i%,m%?2
#i%,0:
fill in word
n%+=1
txt$=
windowtitle(alarms%)
txt$)="*"
txt$=
txt$,1,
(txt$)-2)
changetitle(alarms%,txt$)
this involves a call to FNwindowinfo
n%=!temp%+100
*!n%=main%:
"Wimp_GetWindowInfo",,n%
get position of main% into !temp%+100 after position of alarms% at !temp%
"XOS_File",10,Choicespath$+"Position",&FFD,,!temp%,!temp%+128+28
windowtitle(win%)
windowinfo(win%)
=$(n%!76)
saveerror
param1$=
report(
message_looksub("io"),16)
close_named_channel(
gstrans(Choicespath$+"Alarms")):
gstrans(text$) :
corrupts block%
"OS_GSTrans",text$,block%,255
,,num%
!(block%+num%)=13
=$block%
close_named_channel(file$)
n%,f%,x%,V
n%=255
&20009,254,n%
(S%
&800)=0
/
&20009,7,n%,block%,,,255
,,,,,f%;V
block%?(255-f%)=13
1
1)=0
$block%=file$
x%=n%:n%=-1
#x%:=
Find open channel and get handle
SYS &20009 = SYS"XOS_Args". Based on procedure by Dave Lawrence
redraw(window%,minx%,miny%,maxx%,maxy%,time$)
worktop%,xedge%,top%,ptr%,line%,a$,om%,ox%
window%
alarms%:
ptr%=!anchor_block%
5 xedge%=14+block%!4-block%!20:
left-hand edge
$ worktop%=block%!16-block%!24
Y
maxy%>(worktop%-44)
setGCOL(0,68,153):
minx%,worktop%-44,maxx%-minx%,44
count%
top%=worktop%-52-26
1 ox%=(top%-maxy%+17)
ox%<0
ox%=0
line%=
top_alarm
. om%=1+ox%+line%+(maxy%+17-miny%)
5
om%>(line%+count%-1)
om%=line%+count%-1
(ox%+line%)<=om%
J
printalarmline(ptr%!((line%+ox%)*4),xedge%,top%-ox%*44,time$)
ox%+=1
alert%:
line%=
top_alarm
ptr%=
doublepling(line%)
a$=$(ptr%+10)
top%=-1*((block%!16-block%!8)DIV2)-(45*(?ptr%=0))-26
7 top%=-1*((block%!16-block%!8)
2)-(45*(?ptr%=0))
line%=
'
virtualicon(top%,
a$,line%-1))
a$=
a$,line%+1)
line%=
*
virtualicon(top%-60,
a$,line%-1))
a$=
a$,line%+1)
!
virtualicon(top%-120,a$)
!block%=window%
virtualicon(maxy%,text$)
ptr%
ptr%=block%+152
!ptr%=18
ptr%!4=maxy%-60
ptr%!8=694
ptr%!12=maxy%
ptr%!16=&7000119
$block%=text$
ptr%!20=block%
$(block%+148)=""
ptr%!24=block%+148
ptr%!28=
(text$)
"Wimp_PlotIcon",,ptr%
printalarmline(p%,x%,y%,time$)
n%,p2%,a$,red%
a$=$(!p%+4)
red%=(a$<time$)
red%
setGCOL(221,0,0)
setGCOL(0,0,0)
?(!p%)
4,x%-14,y%+2:
4,x%-14,y%+22:
85,x%-4,y%+12
first byte at !p% is the repeat byte - plot triangle to left of text
decodedate(!p%+4)
"Territory_ConvertDateAndTime",-1,p2%,block%+36,52,"%W3, %ZDY%ST %M3 %CE%YR %Z12:%MI %AM"+
,n%:?n%=13
!"a$=$(block%+36):n%=
a$," ",18)
desktext(
a$,n%-1),x%,y%,red%)
desktext(
a$,n%+1),x%+304,y%,red%)
desktext($(!p%+10),x%+456,y%,red%)
desktext(s$,x%,y%,red%)
width%
notfont%
x%,y%+26:
red%
"Wimp_TextOp",0,&0000F000,&F0F0F000
"Wimp_TextOp",0,&00000000,&F0F0F000
s$=
striptabs(s$,
"Wimp_TextOp" takes tab char as string terminator - although PRINT renders it as a space, a fact formed part of the basic concept of the program :-(
"Wimp_TextOp",2,s$,,,x%,y%
x%,y%:
a$,n%-1):
x%+304,y%:
a$,n%+1):
x%+456,y%:
$(!p%+10)
setGCOL(r%,g%,b%)
"ColourTrans_SetGCOL",(b%<<24)+(g%<<16)+(r%<<8),,,1<<8,0
top_alarm:
Returns offset (in anchor_block%) of 1st alarm
doublepling(n%)=0
n%+=1
nextup(offset%,ptr%):
returns number of hrs/days etc we can increase by
before triggering next day/month etc.
offset%
8:n%=60-(ptr%!offset%)
&C:n%=24-(ptr%!offset%)
&10:n%=
maxdays(ptr%!&14,ptr%!&18)-ptr%!offset%
ignore weeks - treat as 7 day repeat
&14:n%=12-(ptr%!offset%)
&18:n%=ptr%!offset%:
have as many years as you like
H:=n%+1:
we want to go one over limit to trigger change
line(worky%):
which alarm line was clicked on?
L+n%=(-worky%-52)
worky% is negative
n%>=count%
n%=count%-1
we can't close the window small enough when there is only one alarm
n%=-1
n%=0
top_alarm
maxdays(m%,y%):
number of days in a month
n%=0
&10
block%!n%=1
blank block
block%!&14=m%
Y)block%!&18=y%:
in case of leap years
"Territory_ConvertOrdinalsToTime",-1,block%+60,block%
"Territory_ReadCalendarInformation",-1,block%+60,block%
=block%!12
doublepling(alarm%):
returns address of text of alarm alarm%
ptr%
a#ptr%=!(!anchor_block%+alarm%*4)
=!ptr%
looped(NUM%,LIMIT%) :
transforms NUM to a no. between 1 and LIMIT
e =(LIMIT%+NUM%-1)
LIMIT% +1
loopzero(num%,limit%):
does same for 0 to limit%
limit%+=1
h%=(limit%+(num%
limit%))
limit%
settoday
!block%=3
"OS_Word",14,block%
puttime(block%)
puttime(UTC%)
h%,n%,m%,a$,d$
"Territory_ConvertDateAndTime",-1,UTC%,block%+24,30,"%W3%ZDY%ST
%CE%YR"
?n%=13
sJd$=$(block%+24):
Preserve date (since we are about to corrupt block%)
"Territory_ConvertTimeToOrdinals",1,UTC%,timeblock%
We want dates as strings, but time as numbers
This is supposed to make the program international, but I'm not convinced.
w1n%=!minute%
n% gives the 'fudge factor'
!minute%=!minute%-n%
n%>2
!minute%+=5:
round to nearest five minutes
m%=!minute%:h%=!hour%
h%>11
icongreyed(edit%,am%,1):
icongreyed(edit%,pm%,0):
icongreyed(edit%,pm%,1):
icongreyed(edit%,am%,0)
m%>30
loopzero(!hour%+1,23):
round up to next hour
((m%
60)=0
message_lookup("o")
'AND h%' means AND h% > 0 - can't have 'midnight o'clock'!
seticontext(edit%,time%,
message_lookup("m"+
(m%))+
message_lookup("hr"+
(h%))+a$)
Now do date
seticontext(edit%,day%,
d$,3))
seticontext(edit%,date%,
d$,4,n%-4))
n%+=1
",n%)
seticontext(edit%,mth%,
d$,n%,m%-n%))
seticontext(edit%,year%,
d$,m%+1))
icongreyed(window%,icon%,n%)
putbit(window%,icon%,22,n%)
iconselect(window%,icon%,n%)
putbit(window%,icon%,21,n%)
clearalarm
iconselect(edit%,rept%,0):
clear repeat icon
Crep_interval%=default_rep_interval%:rep_type%=default_rep_type%
write_weekdays(0)
reset repeat window
closewindow(repeat%)
n%=0
seticontext(edit%,
("m"+
(n%+1)+"%"),"")
closewindow(window%)
block%!0=window%
"Wimp_CloseWindow",,block%
window%
edit%:
closewindow(repeat%):a$=
message_lookup("ws"):
changetitle(edit%,a$)
warning%,alert%:
"XWimp_SetCaretPosition",block%!200,block%!204,block%!208,block%!212,block%!216,block%!220
put caret back in window from which we stole it (if possible)
beep%=
main%:
iconselected(win%,icon%)
block%!0=win%
block%!4=icon%
"Wimp_GetIconState",,block%
=(block%!24>>21)
fonticon(text$,handle%)
n%,ptr%
n% 6
$n%=text$
$(n%+3)="F17"
block%!0=edit%
ptr%=block%+4
ptr%!0=648
ptr%!8=704
text$
"AM":ptr%!4=-112:ptr%!12=-68
"PM":ptr%!4=-156:ptr%!12=-112
:ptr%!16=&400159
handle%<<24:
insert fonthandle here
ptr%!20=n%
ptr%!24=n%+3
ptr%!28=3
"Wimp_CreateIcon",edit%,block%
keypress(key%)
block%!0
edit%:
key%
]
&12:
putbit(edit%,rept%,21,
iconselected(edit%,rept%)-1):
click(edit%,rept%,4):n%=1
<
CTRL-R: toggle state of repeat icon and fake click
@
&1B:
closewindow(edit%):
this will also close repeat%
newalarm
.
iconselect(edit%,edit_ok%,1)
)
closewindow(edit%):n%=1
.
iconselect(edit%,edit_ok%,0)
alert%,warning%:
key%=13
click(block%!0,0,4):n%=1:
fake default click if 'hot-key press' detected
j
key%=27
block%!0=warning%
click(warning%,1,4):n%=1:
fake 'Cancel' click
n%=0
"Wimp_ProcessKey",key%
newalarm
i%,n%,ptr%,txt$,m%,a$
timestring(timeblock%)
hope that timeblock% is correctly set up by PROCchangetime/PROCputtime
!block%=3
"OS_Word",14,block%
"Territory_ConvertTimeToOrdinals",1,block%,block%+8
timestring(block%+8)>a$
report(
message_lookup("early"),0):=
count%
top_alarm
i%=anchors%:
avoid address exceptions
windowtitle(edit%)=
message_lookup("we")
i%=whichinmenu%+1:count%-=1
when editing we don't actually want to increase the number of alarms
Ztxt$=
geticontext(edit%,m1%)+
geticontext(edit%,m2%)+
geticontext(edit%,m3%)
(txt$)
notfont%
"Wimp_TextOp",1,
striptabs(txt$,
m%:m%=m%/16
m%>max% max%=m%:
for resizing window
allocate_alarm_block(i%,txt$)
iconselected(edit%,rept%)
?m%=rep_type%:m%?1=rep_interval%:m%?2=
read_weekdays
!m%=0
$(m%+4)=a$:$(m%+10)=txt$
resizewindow(count%,
allocate_alarm_block(top%,txt$):
must know txt$ so block is right size
m%,n%,ptr%
top%
J n%=(top%-1)*4:
top% is the top *alarm* - we want the preceding slot
D count%+=1:
no. of alarms is changing - but not no. of anchors
ptr%=!anchor_block%
extend_named_sliding_block(ptr%!n%,4+
(txt$)+5+2)
m%=
doublepling(top%-1)
no empty slots
P n%=anchors%*4:
will be anchors%-1 when we increment anchors% in next line
! anchors%+=1:count%=anchors%
extend_named_sliding_block(anchor_block%,anchors%*4)
H ptr%=!anchor_block%:
it may well have moved after resizing block!
& ptr%!n%=
create_anchor(
(65+n%))
create_named_sliding_block(ptr%!n%,4+
(txt$)+5+2)
! m%=
doublepling(anchors%-1)
alarmtowindow(num%)
alarm%,ptr%,n%,a$
alarm%=
doublepling(num%)
n%=?alarm%
) rep_type%=n%:rep_interval%=alarm%?1
iconselect(edit%,rept%,1)
seticontext(repeat%,rept_num%,
(rep_interval%))
seticontext(repeat%,div%,
message_lookup("i"+
(rep_type%)))
write_weekdays(alarm%?2)
click(edit%,rept%,4)
simulate click on 'repeat' icon in order to open window
next to where edit window will be
iconselect(edit%,rept%,0)
closewindow(repeat%)
close repeat window if already open, and not wanted
2ptr%=
decodedate(alarm%+4):
Returns UTC block
puttime(ptr%)
a$=$(alarm%+10)
seticontext(edit%,m1%,
a$,n%-1))
a$,n%+1)
seticontext(edit%,m2%,
a$,n%-1))
a$,n%+1)
seticontext(edit%,m3%,a$)
deletealarm(num%,close%)
ptr%
close%
closewindow(edit%):
just in case
but don't close if we are faking edit of last alarm to go off
ptr%=!anchor_block%
scrap_sliding_block(ptr%!(num%*4))
count%-=1
resizewindow(count%,
block should already have been filled by PROCresizewindow
(block%!32
1<<16)
"Wimp_OpenWindow",,block%
redraws window with bottom line missing if it is actually open
(if not, it doesn't need redrawing & we certainly don't want it to pop up!)
changetime(icon%,button%)
n%,h%,m%,y%,a$,d$
icon%
hrup%,hrdown%:
;E !hour%+=(icon%=hrdown%
button%=1)-(icon%=hrup%
button%=1)
<3
Using ADJUST reverses direction of arrows
minup%,mindown%:
>M !minute%+=5*(icon%=mindown%
button%=1)-5*(icon%=minup%
button%=1)
?0
increment/decrement hour appropriately
dayup%,daydn%:
AF !dayno%+=(icon%=daydn%
button%=1)-(icon%=dayup%
button%=1)
mthup%,mthdn%:
CF !month%+=(icon%=mthdn%
button%=1)-(icon%=mthup%
button%=1)
yrup%,yrdown%:
EC !yr%+=(icon%=yrdown%
button%=1)-(icon%=yrup%
button%=1)
adjusttime(timeblock%,icon%)
h%=!hour%
putbit(edit%,am%,22,(h%>11)*-1):
putbit(edit%,pm%,22,(h%<12)*-1):
set am% and pm% according to whether h% is at least 12 or not
m%=!minute%
m%>30
loopzero(h%+1,23):
round to next hour
(m%
60=0
message_lookup("o")
'AND h%' - i.e. AND h% > 0 - can't have 'midnight o'clock'!
seticontext(edit%,time%,
message_lookup("m"+
(m%))+
message_lookup("hr"+
(h%))+a$)
Now do date
"Territory_ConvertOrdinalsToTime",-1,block%,timeblock%
"Territory_ConvertDateAndTime",-1,block%,block%+24,30,"%W3%ZDY%ST
%CE%YR"
Let RISC-OS do the difficult bit this time!
?n%=13
d$=$(block%+24)
seticontext(edit%,day%,
d$,3))
seticontext(edit%,date%,
d$,4,n%-4))
Y n%+=1
",n%)
seticontext(edit%,mth%,
d$,n%,m%-n%))
seticontext(edit%,year%,
d$,m%+1))
repeat_or_delay(window%,icon%,button%,
interval%,
type%)
the delay window has same icons as repeat - so use same procedure for both!
type%=1
m%=5
m%=1
icon%
d"
numup%,numdn%:
e\ interval%+=m%*(icon%=numdn%
button%=1)-m%*(icon%=numup%
button%=1)
f6 interval%=
looped(interval%,255)
g"
divup%,divdn%:
hR type%+=(icon%=divdn%
button%=1)-(icon%=divup%
button%=1)
i, type%=
looped(type%,6)
jS
type%=1
interval%-=interval%
interval%=0
interval%=5
kv
seticontext(window%,rept_num%,
(interval%)):
seticontext(window%,div%,
message_lookup("i"+
(type%)))
read_weekdays
o%,n%
n%=9
q+ o%+=
iconselected(repeat%,n%)<<(n%-9)
write_weekdays(byte%)
n%=9
iconselect(repeat%,n%,1
(byte%>>(n%-9)))
Note that the icons appear 'ticked' when NOT selected!
nottoday(byte%,now$)
m%,ptr%,day%
now$=
(254)
in case we press escape while calculating repeats
$block%=now$
ptr%=
decodedate(block%)
"Territory_ConvertDateAndTime",-1,ptr%,block%,10,"%wn"
day%=?block%-48
loopzero(day%-2,6)
(byte%
(1<<m%))
adjusttime(ptr%,icon%):
calculate side-effects of change
ptr% points to block of ordinals
#ptr%!&c+=(ptr%!8<0)-(ptr%!8>59)
&ptr%!&10+=(ptr%!&c<0)-(ptr%!&c>23)
ptr%!&10>
maxdays(ptr%!&14,ptr%!&18)
icon%
V
mthup%,mthdn%,yrup%,yrdown%:ptr%!&10=
maxdays(ptr%!&14,ptr%!&18)
,
:ptr%!&10=1:ptr%!&14+=1
ptr%!&10=0
ptr%!&14-=1:ptr%!&10=
maxdays(ptr%!&14,ptr%!&18)
(ptr%!&18+=(ptr%!&14<1)-(ptr%!&14>12)
ptr%!8=
loopzero(ptr%!8,59)
!ptr%!&c=
loopzero(ptr%!&c,23)
!ptr%!&14=
looped(ptr%!&14,12)
NewAlarm file format
It seems reasonable to have alarms as a single data file inside application.
i.e. no file type used
First byte/no. - number of alarms in file
Better check for absence of file, indicating 0 alarms also!
If 0 alarms, don't claim memory
For each alarm: 5-byte time string
text (* for task alarm?)
Each alarm needs to have its own sliding block in case it gets edited
and changes length - also so that we can sort them into date order
Overheads will be enormous! :-(
So we need to create a block to hold the anchors
repeats follow after end of text string
repeats: one byte for rep_type%
if rep_type% > 0:
one byte for number of intervals
?2? bytes containing days applicable
Note that IN MEMORY the repeat block comes FIRST, followed by time string
and then the text string.
putbit(whan%,icon%,bit%,state%)
state%
state%=1
!block%=whan%
block%!4=icon%
block%!8=state%<<bit%
block%!12=1<<bit%
"Wimp_SetIconState",,block%
putnameinmenu(screeny%)
worky%,a$,ptr%,n%,m%
!block%=alarms%
"Wimp_GetWindowInfo",,block%
)worky%=screeny%-(block%!16-block%!24)
visible area - scroll offset; top of work area in screen co-ordinates
Nwhichinmenu%=
line(worky%):
global variable for use in PROCmenu_selection
#ptr%=
doublepling(whichinmenu%)
'm%=?ptr%:
is it a repeating alarm?
a$=$(ptr%+10):n%=
n%>13
n%=13:
a$,12,1)=" "
n%=12
Abbreviate to 12 chars or to nearest word
we assume not more than one space between words for simplicity's sake!
a$,n%-1)
param1$=a$
%ptr%=
submenuhandle(alarmmenu%,1)
&$(ptr%!12)=
message_looksub("del")
ptr%+=24
&$(ptr%!12)=
message_looksub("chn")
ptr%+=24
&$(ptr%!12)=
message_looksub("cpy")
ptr%+=24
grey(ptr%+8,(m%=0)):
grey out 'defer' line if not repeating alarm
&$(ptr%!12)=
message_looksub("def")
resizewindow(lines%,change%):
resize and redraw window (and asterisk)
n%,a$
$n%=max%*16+480:
n%<880
n%=880
resize window appropriately
resize(alarms%,n%,(lines%+1)*44)
make room for lines% lines plus a header line
!block%=alarms%
"Wimp_GetWindowInfo",,block%:
get (new) visible area
n%=block%!32
change%
a$=$(block%!76)
a$)<>"*"
a$+=" *":$(block%!76)=a$:
mark window as changed
(n%
1<<16)=0
window is not open - don't redraw area
"Wimp_ForceRedraw",-1,block%!4,block%!8,block%!12,block%!16+44
update screen given absolute co-ordinates
SOUND 1,-2,134,8
extend_named_sliding_block(workblock%,anchors%*4)
"OS_HeapSort",anchors%,(!workblock%)+(1<<30),ourcode%,,!anchor_block%,4
"SlidingHeap_VerifyHeap",slidingheapbase%
resize(window%,width%,height%)
LOCAL flags%,op%
;!block%=0:block%!4=-height%:block%!8=width%:block%!12=0
"Wimp_SetExtent",window%,block%
!block%=window%
"Wimp_GetWindowState",,block%
block%!8=block%!16-height%
block%!12=block%!4+width%
block%!20=0:block%!24=0
flags%=block%!32
op%=(flags%>>16)
op%=0 block%!28=-3
"Wimp_OpenWindow",,block%
decodedate(ptr%)
year,month,day,hour,minute
n%,now$
now$=$(ptr%)
4block%!0=0:block%!4=0:
seconds and centiseconds
n%=1
+ block%!(&18-(n%-1)*4)=
now$,n%))-65
block%!&18+=1990
block%!&18>2100
255," Too far in the future"
"Territory_ConvertOrdinalsToTime",-1,block%+100,block%
=block%+100
set_off_alarm(num%,now$,sound%)
a$,ptr%,n%,m%
closewindow(edit%):
just in case we happen to be editing...
doublepling(num%)
a$=$(n%+10)
extend_named_sliding_block(last%,10+
(a$)+1)
doublepling(num%):
in case block slides
$(!last%+10)=a$
a$=$(n%+4):$(!last%+4)=a$
take a copy of alarm data (but not repeats)
grey(
submenuhandle(mainmenu%,5)+8,
ungrey menu entry - we now have a 'most recent alarm'
message_lookup("format")
+ptr%=
decodedate(n%+4):
UTC time block
m%=0
&18
' !(!repeat_time%+(m%))=block%!(m%)
"Territory_ConvertDateAndTime",-1,ptr%,block%,255,a$
,ptr%
?ptr%=13
seticontext(alert%,1,$block%)
?n%=0
$ m%=1
& m%=0
nextrepeat(n%,a$,now$)
a$=CHR$(254) if we aborted repeat calculations
a$<>
(254)
seticontext(alert%,3,a$)
(254)
?n%=0:
alarm_gone_off:
if we aborted a repeating alarm, pretend that:
a) it was not a repeating alarm and
b) it has already gone off
(?n%)>0
nottoday(n%?2,now$)
alarm_gone_off:
check days byte
n%?10=
("*")
a$=$(n%+10):
"Wimp_StartTask",
striptabs(a$,
alarm_gone_off:
Task alarms don't open the alert window (note DON'T substitute spaces here)
note m% must be *0* to display icon (i.e. 'deleted' flag OFF)
putbit(alert%,2,23,m%):
mark icon as deleted
putbit(alert%,3,23,m%):
(unless there really is a repeat)
6 beep%=sound%:
centre(alert%)
reason(0)
beep%=
Note that if beep%=1 then window opens but PROCbeep is silent
striptabs(text$,sub%)
text$,
D@
sub%
text$,n%)=" "
text$=
text$,n%-1)+
text$,n%+1)
=text$
alarm_gone_off
Called when alert window closed or after silent (not today) alarm calculated
if there is a repeat, date will already have been altered
top_alarm
doublepling(n%))=0
deletealarm(n%,
PROCdeletealarm includes a sort
closewindow(alert%)
resizewindow(count%,
add asterisk as alarm has been changed
autosave%
savealarms
check_time(
check if another alarm is due
readlastalarm
i%,m%,ptr%
count%
top_alarm
i%=anchors%:
avoid address exceptions
ptr%=!last%
[+m%=
allocate_alarm_block(i%,$(ptr%+10))
\:ptr%=!last%:
if blocks were shifted it may have moved
])$(m%+4)=$(ptr%+4):$(m%+10)=$(ptr%+10)
^$!m%=0:
forget about any repeats
nextrepeat(ptr%,format$,now$)
returns next repeat date as string
also updates existing alarm with new date
y%,boundary%,m%,store%,num%
num%=ptr%?1
?ptr%
1:y%=8
2:y%=&C
3:y%=&10
4:num%=num%*7:y%=&10:
treat weeks as seven days
5:y%=&14
6:y%=&18
oLstore%=num%:
so we can add same again if repeat still earlier than now$
pKm%=!repeat_time%:
saves recalculating this every time we call FNnextup
"Hourglass_On":
in case of multiple repeats - 1/3 second delay so will
not appear under normal circumstances
num%=store%
v boundary%=
nextup(y%,m%)
wy
boundary%<num%
m%!y%+=boundary%
m%!y%+=num%:
increase time just enough to change next size of time unit up
adjusttime(m%,0)
num%-=boundary%
num%<1
timestring(m%)
(-113)
escape(a$)
continue until we have added entire specified amount
a$>now$
nottoday(ptr%?2,a$)=
"Hourglass_Off"
(254)
=a$:
i.e. we aborted in PROCescape
"Territory_ConvertOrdinalsToTime",-1,block%+100,!repeat_time%
"Territory_ConvertDateAndTime",-1,block%+100,block%,100,format$+
?m%=13
K$(ptr%+4)=
timestring(!repeat_time%):
substitute new time code for old
=$block%
escape(
x%,b$,m%,ptr%
ptr%=!temp%
m%=!repeat_time%
x%=8
&18
ptr%!x%=m%!x%
OS calls seem to corrupt ordinals
"Territory_ConvertOrdinalsToTime",-1,block%+100,!repeat_time%
"Territory_ConvertDateAndTime",-1,block%+100,block%,100,format$+
?m%=13
b$=$block%
x%=8
&18
m%!x%=ptr%!x%
restore ordinals
Uparam1$=b$:param2$=
message_lookup("this"):
report(
message_looksub("reach"),256)
errclick%=1
(254)
The point of this is that CHR$(254) will *always* be greater than now$
"Hourglass_On"
SYS"Wimp_Poll",0,block%
to remove the error box and restore hourglass
editalarm(num%)
alarmtowindow(num%)
changetitle(edit%,
message_lookup("we"))
will be restored to "Set" on window close
openwindow(edit%)
copy_alarm(num%,delete_old%)
put alarm data into edit window
ptr%,d$
ptr%=
doublepling(num%)
delete_old%
$(ptr%+4)=
now(d$):
d$ is dummy value
alarmtowindow(num%)
openwindow(edit%)
delete_old%
deletealarm(num%,
centre(win%)
x%,y%,width%,height%,ptr%
SYS"OS_ReadModeVariable",-1,11TO,,x%:SYS"OS_ReadModeVariable",-1,12TO,,y%:SYS"OS_ReadModeVariable",-1,4TO,,xe%:SYS"OS_ReadModeVariable",-1,5TO,,ye%
x%=x%<<xe%:y%=y%<<ye%:
screensize(x%,y%)
x%=x%/2:y%=y%/2
!block%=win%
"Wimp_GetWindowState",,block%
width%=block%!12-block%!4
height%=block%!16-block%!8
block%!4=x%-width%/2
block%!12=x%+width%/2
block%!8=y%-height%/2
block%!16=y%+height%/2
ptr%=!temp%
?ptr%=1
/ptr%?1=(block%!4)
256:ptr%?2=(block%!4)
/ptr%?3=(block%!8)
256:ptr%?4=(block%!8)
1ptr%?5=(block%!12)
256:ptr%?6=(block%!12)
1ptr%?7=(block%!16)
256:ptr%?8=(block%!16)
"OS_Word",21,ptr%
block%!28=-1
"Wimp_OpenWindow",,block%
"Wimp_GetCaretPosition",,block%+200:
preserve old caret position
"Wimp_SetCaretPosition",win%,-1,0,0,-1,-1:
for 'hot-keys'
screensize(
xe%,ye%
"OS_ReadModeVariable",-1,11
"OS_ReadModeVariable",-1,12
"OS_ReadModeVariable",-1,4
,,xe%
"OS_ReadModeVariable",-1,5
,,ye%
x%=x%<<xe%:y%=y%<<ye%
message
ptr%,n%,txt$
block%!16
0 :
8 :
windowtitle(alarms%))="*"
=
!block%<20
block%!20=0
shutdown%=
' block%!12=block%!8
<
"Wimp_SendMessage",19,block%,block%!4
Acknowledge Prequit message to abort quit - restart it manually later if necessary
%
centre(warning%)
Q
if no unsaved data just ignore Prequit message - let it bounce
&502 :
dohelp
&400C1 :
user_modechange